package com.xiao.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiao.mapper.ArticleMapper;
import com.xiao.pojo.Article;
import com.xiao.uitl.es.ESUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {

    @Autowired
    ESUtil esUtil;

    @Override
    public List<Article> getAllArticle() {
        List<Article> articles = this.baseMapper.selectList(null);

        return articles;
    }

    @Override
    public String queryArticle(String keyword) throws IOException {
        return esUtil.search(keyword);
    }
}
